//
//  StatusesCell.swift
//  新浪微博
//
//  Created by mac on 15/12/1.
//  Copyright © 2015年 mac. All rights reserved.
//

import UIKit
import SnapKit

let StatusesCellMargin: CGFloat = 12
let StatusesCellWidth: CGFloat = 35

class StatusesCell: UITableViewCell {
//通过xib创建才会来到此方法
//    override func awakeFromNib() {
//        super.awakeFromNib()
//        // Initialization code
//    }
    var status: Statues?{
        didSet{
         originalView.status = status
        }
    }
    
    //MARK 重写初始化方法
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        setupUI()
    }
 
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    private func setupUI(){
        contentView.addSubview(originalView)
        contentView.addSubview(bottomView)
               //设置布局
        originalView.snp_makeConstraints { (make) -> Void in
            make.top.left.right.equalTo(contentView)
        }
        bottomView.snp_makeConstraints { (make) -> Void in
            make.top.equalTo(originalView.snp_bottom)
            make.left.right.equalTo(contentView)
            make.height.equalTo(40)
        }
        

        
        
        
        //需要给contentview设置约束
        contentView.snp_makeConstraints { (make) -> Void in
            make.top.left.right.equalTo(self)
            //底部的约束很关键
            make.bottom.equalTo(bottomView.snp_bottom)
            
            
        }
    }
    
    //MARK 懒加载子控件
    private lazy var originalView: StatusesOriginalView = StatusesOriginalView()
    private lazy var bottomView: StatusesBottomView = StatusesBottomView()
    
    
    
    
    
}
